xen: credit2: prevent load balancing to go mad if time goes backwards
authorDario Faggioli <dario.faggioli@citrix.com>
Fri, 15 Jul 2016 14:49:18 +0000 (16:49 +0200)
committerGeorge Dunlap <george.dunlap@citrix.com>
Mon, 18 Jul 2016 16:51:13 +0000 (17:51 +0100)
commit11eadabc34625337f7556e9d74f638229f889fd8
treebf126af3f0caefe2baf476457bfaac5c8d569e25
parentb047f888d4896d0e6cca10fbc996d4f1e1d769b2
xen: credit2: prevent load balancing to go mad if time goes backwards

This really should not happen, but:
 1. it does happen! Some more info here:
    http://lists.xen.org/archives/html/xen-devel/2016-06/msg00922.html
 2. independently from 1, it makes sense and is easy enough
    to have a 'safety catch'.

The reason why this is particularly bad for Credit2 is that
negative values of delta mean out of scale high load (because
of the conversion to unsigned). This, for instance in the
case of runqueue load, results in a runqueue having its load
updated to values of the order of 10000% or so, which in turns
means that the load balancer will migrate everything off from
the pCPUs in the runqueue, and leave them idle until the load
gets back to something sane... which may indeed take a while!

This is not a fix for the problem of time going backwards. In
fact, if that happens a lot, load tracking accuracy is still
compromized, but at least the effect is a lot less bad than
before.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
xen/common/sched_credit2.c